
#include <QObject>
#include <QDebug>
#include <QMouseEvent>
#include "../dockwidget.h"
//#include "../qdock.h"
#include "../dockmanager.h"
#include "../layoutmanager.h"
#include "../previewer.h"
#include "../policymanager.h"
extern DockManager* dm;
static void initDM(){
    dm = new DockManager();
    dm->setPreviewer(new UDockWidgetPreviewer());
    dm->setPolicyManager(new QPolicyManager());
    dm->setLayoutManager(new QLayoutManager());

}

class WindowMover : public QObject {
    Q_OBJECT
public:

    void addWidget(UDockWidget* dw){
        connect(dw,SIGNAL(mouseDown(QDockItem*,QMouseEvent*)), this,  SLOT(mouseDown(QDockItem*,QMouseEvent*)));
        connect(dw,SIGNAL(mouseUp(QDockItem*,QMouseEvent*)), this,  SLOT(mouseUp(QDockItem*,QMouseEvent*)));
        connect(dw,SIGNAL(mouseMove(QDockItem*,QMouseEvent*)), this,  SLOT(mouseMove(QDockItem*,QMouseEvent*)));
    }


public slots:
    void mouseUp(QDockItem* dw, QMouseEvent* ev)    {
//        qDebug()<< "mouseup";
        dm->mouseUp(dw,QPoint(ev->globalX(),ev->globalY()));
    }
    void mouseDown(QDockItem* dw, QMouseEvent* ev)    {
//        qDebug()<< "mousedown";
        dm->mouseDown(dw,QPoint(ev->globalX(),ev->globalY()),ev->pos());
    }
    void mouseMove(QDockItem* dw, QMouseEvent* ev)    {
//        qDebug()<< "mousemove";
        dm->mouseMove(dw, QPoint(ev->globalX(),ev->globalY()));
    }

public:
};

